package com.solr.sboot.solr.repository;

import com.solr.sboot.solr.po.DocumentPo;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.solr.repository.Query;
import org.springframework.data.solr.repository.SolrCrudRepository;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @描述:
 * @类名:
 * @作者: yangshuang
 * @创建时间: 2017/8/21 14:14
 * @版本: v1.0
 */
@Repository
public interface DocumentRepository extends SolrCrudRepository<DocumentPo, String> {

    @Query("id:*?0*")
    List<DocumentPo> findByQueryAnnotation(String searchTerm);


    /**
     * 模糊查询
     * @param searchName
     * @param pageable
     * @return
     */
    @Query("id:*?0* OR title:*?0*")
    Page<DocumentPo> findByCustomQuery(String searchName, Pageable pageable);
}
